%% Figure 1

[Data] = xlsread('Data.xlsx','data_figure_1');

GSCPI = Data(:,1);
PI = Data(:,2);

f = figure();

yyaxis left
plot(GSCPI,'-k','LineWidth',3);
ylabel('Global Supply Chain Pressure Index')
yyaxis right
plot(PI,'-b','LineWidth',3)
ylabel('Annual CPI Inflation')
grid on
xlim([1 length(GSCPI)])
legend('GSCPI (left axis)', 'Annual CPI Inflation (right axis)','NumColumns',1,'Location','northwest','FontSize',20)
legend boxoff 
set(gcf,'color','w');
matT=[1 25 49 73 97 121 145 169 193 217  241 265 289];
matTx={'1998';'2000';'2002';'2004';'2006';'2008';'2010';'2012';'2014';'2016';'2018';'2020';'2022'};
ax = gca;
ax.YAxis(1).Color = 'k';
ax.YAxis(2).Color = 'b';
set(gcf, 'Position', get(0, 'Screensize'));
set(gca,'XTick',matT)
set(gca,'XTickLabel',matTx,'fontsize',20)
%saveas(gcf,'GSCPI_Inflation.png')
%saveas(gcf,'GSCPI_Inflation.eps','epsc')

f = figure();
plot(GSCPI,'-k','LineWidth',3);
ylabel('Global Supply Chain Pressure Index')
grid on
xlim([1 length(GSCPI)])
set(gcf,'color','w');
matT=[1 25 49 73 97 121 145 169 193 217  241 265 289];
matTx={'1998';'2000';'2002';'2004';'2006';'2008';'2010';'2012';'2014';'2016';'2018';'2020';'2022'};
ax = gca;
set(gcf, 'Position', get(0, 'Screensize'));
set(gca,'XTick',matT)
set(gca,'XTickLabel',matTx,'fontsize',20)
%saveas(gcf,'GSCPI.png')
%saveas(gcf,'GSCPI.eps','epsc')

%% Figure 2

[Data_Q] = xlsread('Data.xlsx','data_figure_2');

GSCPI_Q = Data_Q(:,1);
Vlad_full_sample = Data_Q(:,2);
Vlad_compustat_sample = Data_Q(:,3);

GSCPI_m = GSCPI;
GSSDI = Data(:,3);
SBC = Data(:,4);

GSCPI_m2 = Data(127:283,1);
Bloomberg = Data(127:283,5);

f = figure();
subplot(2,2,1)
yyaxis left
plot(GSCPI_m,'-k','LineWidth',2.5);
ylabel('GSCPI','Color','k')
xlim([1 length(GSCPI_m)])
yyaxis right
plot(GSSDI,'-.b','LineWidth',2.5)
ylabel('Global Sectoral Supply Disruption Index','Color','b')
grid on
legend('GSCPI (left axis)', 'GSSDI (right axis)','Location','northwest','FontSize',12)
legend boxoff 
ax = gca;
ax.YAxis(1).Color = 'k';
ax.YAxis(2).Color = 'k';
set(gcf, 'Position', get(0, 'Screensize'));
set(gca,'XTick',matT)
set(gca,'XTickLabel',matTx,'fontsize',12)
set(gca,'xtick',[1 49 97 145 193 241 289],...
    'xticklabel',{'1998m1';'2002m1';'2006m1';'2010m1';'2014m1';'2018m1';'2022m1';})

subplot(2,2,2)
yyaxis left
plot(GSCPI_Q,'-k','LineWidth',2.5);
ylabel('GSCPI','Color','k')
xlim([1 length(GSCPI_Q)])
yyaxis right
plot(Vlad_full_sample,'-.b','LineWidth',2.5)
ylabel('Share of disrupted Trade Pairs','Color','b')
grid on
legend('GSCPI (left axis)', 'Share of disrupted trade pairs - full sample (right axis)','Location','northwest','FontSize',12)
legend boxoff 
ax = gca;
ax.YAxis(1).Color = 'k';
ax.YAxis(2).Color = 'k';
set(gcf, 'Position', get(0, 'Screensize'));
set(gca,'XTick',matT)
set(gca,'XTickLabel',matTx,'fontsize',12)
set(gca,'xtick',[7 15 23 31 39 47],...
    'xticklabel',{'2010Q1';'2012Q1';'2014Q1';'2016Q1';'2018Q1';'2020Q1'})

subplot(2,2,3)
yyaxis left
plot(GSCPI_m,'-k','LineWidth',2.5);
ylabel('GSCPI','Color','k')
xlim([1 length(GSCPI_m)])
yyaxis right
plot(SBC,'-.b','LineWidth',2.5)
ylabel('Supply Chain Bottleneck Index','Color','b')
grid on
legend('GSCPI (left axis)', 'SBC (right axis)','Location','northwest','FontSize',12)
legend boxoff 
ax = gca;
ax.YAxis(1).Color = 'k';
ax.YAxis(2).Color = 'k';
set(gcf, 'Position', get(0, 'Screensize'));
set(gca,'XTick',matT)
set(gca,'XTickLabel',matTx,'fontsize',12)
set(gca,'xtick',[1 49 97 145 193 241 289],...
    'xticklabel',{'1998m1';'2002m1';'2006m1';'2010m1';'2014m1';'2018m1';'2022m1';})

subplot(2,2,4)
yyaxis left
plot(GSCPI_m2,'-k','LineWidth',2.5);
ylabel('GSCPI','Color','k' )
xlim([1 length(GSCPI_m2)])
yyaxis right
plot(Bloomberg,'-.b','LineWidth',2.5)
ylabel('Bloomberg Supply Constraint Indicator','Color','b')
grid on
legend('GSCPI (left axis)', 'Bloomberg Supply Constraint Indicator (right axis)','Location','northwest','FontSize',12)
legend boxoff 
ax = gca;
ax.YAxis(1).Color = 'k';
ax.YAxis(2).Color = 'k';
set(gcf, 'Position', get(0, 'Screensize'));
set(gca,'XTick',matT)
set(gca,'XTickLabel',matTx,'fontsize',12)
set(gca,'xtick',[19 43 67 91 115 139],...
    'xticklabel',{'2010m1';'2012m1';'2014m1';'2016m1';'2018m1';'2020m1'})
set(gcf,'color','w');
%saveas(gcf,'GSCPI_Comparison.png')
%saveas(gcf,'GSCPI_Comparison.eps','epsc')


